/*
 * @Author: c
 * @Date: 2024-01-15 17:33:03
 * @LastEditTime: 2024-01-16 16:00:08
 * @LastEditors: c
 * @Description:
 * @FilePath: \music-web-admin\src\api\minio\type.ts
 * https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// Copyright 2024 Administrator
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { UploadRawFile } from "element-plus";
import { UploadAjaxError } from "element-plus/es/components/upload/src/ajax";

export type UploadRequestHandler = (
  options: UploadRequestOptions
) => XMLHttpRequest | Promise<unknown>;

export interface UploadProgressEvent extends ProgressEvent {
  percent: number;
}

export interface UploadRequestOptions {
  action: string;
  method: string;
  data: Record<string, string | Blob | [string | Blob, string]>;
  filename: string;
  file: UploadRawFile;
  headers: Headers | Record<string, string | number | null | undefined>;
  onError: (evt: UploadAjaxError) => void;
  onProgress: (evt: UploadProgressEvent) => void;
  onSuccess: (response: any) => void;
  withCredentials: boolean;
}

// export class UploadFileDto {
//   //创建者username
//   creator?: string;

//   //文件名称
//   name?: string;

//   //浏览器读取文件的时间戳

//   uid?: number;

//   //上传进度

//   percentage?: number;

//   //文件的状态
//   status?: string;

//   //文件大小
//   size?: number;

//   //文件的链接/本地的或者远程的
//   url?: string;

//   //文件最后修改时间
//   lastModified?: number;

//   //文件mime类型
//   type?: string;

//   webkitRelativePath?: string;
// }

//歌手/用户的相册列表中图片类型
export enum PictorialEnum {
  //未知
  NULL = 0,
  //头像
  AVATAR = 1,
  //画报
  PICTORIAL = 2,
}
